package com.wutianyi.pool.concurrent.example;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class ReentrantLockUnfairBeanchmarkDemo implements Counter{
	
	private volatile long count = 0;
	private Lock lock;
	
	public ReentrantLockUnfairBeanchmarkDemo() {
		lock = new ReentrantLock(false);
	}
	
	@Override
	public long getValue() {
		return count;
	}

	@Override
	public void increment() {
		lock.lock();
		try{
			count ++;
		} finally {
			lock.unlock();
		}
	}

}
